Simulating Artificial Animals with Neural Network
Information
I saw various videos on Neural Networks and simulating artificial life.
Using a neural network to simulate how an animal may behave really interested me, so this was my first attempt at it.
This simulation uses a genetic algorithm to train small animals to move towards "food".
Documentation
Built With
- Raylib
- C++
- Dearimgui
Controls
Simulation Controls
- KEY_F: Reset Simulation
- KEY_R: Toggle between 1D and 2D velocity (may affect animal performance)
- KEY_SPACE: Toggle between 1x time and 60x time
File Controls
- KEY_ENTER: Submit file action
- KEYNUM_1: Toggle Creating file flag(onlyexport)
- KEYNUM_2: Toggle Import or export flag
- KEYNUM_3: Cycle files
- KEYNUM_4: Toggle wether to use historic generation or current when writing to file(onlyexport)
Sample of Import Gui
Sample of Export Gui
Values and Understanding
Statistics Use
Here is the gui with all the statistics.
The statistics window has a lot of useful information about our simulation.
- Elasped: Simulation runtime
- Time: Generation runtime (limit 60 sec before reset)
- Generation: Current iteration of simulation
- Best Score: Best historical fitness score of current simulation. When saving by historical, it will grab this dataset
- Generation Best: Current iterations best fitness score
About Animal Structure
Image of animals in the simulation, the bottom number is there fitness while the top number is the health. Once the health reach zero, they will die.
This Graph shows the brainwave of the best performing animal. The output of the animals brain is in the 4 absolute directions.
Download
Minimum 1000x1000 Screen Size
Download link